package com.mz.ozy.mvp.model;

import android.content.Context;
import android.text.TextUtils;

import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;
import com.mz.ozy.utils.MD5Util;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class C2cTradeModel {

    public Observable<ResponseBody> geAssetsInfo(Context context, String type, String page) {
        Map<String, String> maps = new HashMap<>();
        maps.put("type", type);
        maps.put("pageNo", page);
        maps.put("pageSize", Constants.PageSize);
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10100, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> submitOrder(Context context, String id, String type, String number, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("id", id);
        maps.put("type", type);
        maps.put("num", number);
        if (!TextUtils.isEmpty(password)) {
            maps.put("password", MD5Util.getMD5String(password));
        }
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10101, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }
}
